<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCustomerDoctorsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_doctors', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('customer_id')->comment('所属医院/机构');
            $table->unsignedInteger('department_id')->comment('所属科室/部门');
            $table->string('title')->comment('姓名');
            $table->string('code')->unique()->comment('编号');
            $table->string('job_title')->nullable()->comment('职称');
            $table->unsignedTinyInteger('is_monthly')->default(2)->comment('是否月结，0:否,1:是,2:未知');
            $table->unsignedInteger('salesman')->nullable()->comment('所属销售');
            $table->string('phone')->nullable()->comment('手机号');
            $table->string('email')->nullable()->comment('邮箱');
            $table->string('alipay')->nullable()->comment('支付宝');
            $table->string('wechat')->nullable()->comment('微信号');
            $table->string('field')->nullable()->comment('专业领域(从字典选择)');
            $table->string('type')->comment('客户类别(从字典选择)');
            $table->text('intro')->nullable()->comment('客户简介');
            $table->text('specialty')->nullable()->comment('就诊特点');
            $table->text('other')->nullable()->comment('其他信息');
            $table->unsignedInteger('region')->comment('所属大区');
            $table->unsignedInteger('province')->comment('所属省区');
            $table->unsignedTinyInteger('state')->default(1)->comment('是否有效，0:无效,1:有效');
            $table->unsignedInteger('created_by')->comment('创建者');
            $table->unsignedInteger('updated_by')->comment('更新者');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '客户医生表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_doctors');
    }

}
